package com.kfm.base.reg;

public class Demo {

    public static void main(String[] args) {
        /*
        正则表达式
            ^[a-zA-Z0-9_-]+@.+.com$
            ^1[0-9]{10}$

            密码  6位以上， 包含 数字 字母 _
         */
        String str = "1085473391@qq.com";
        String reg = "^[a-zA-Z0-9_-]+@.+.com$";

        String reg1 = "\\d";
        boolean result = str.matches(reg);

        String s = str.replaceAll(reg1, "*");
        System.out.println(result);
        System.out.println(s);

        str = "12345a";
        System.out.println(str.replaceFirst("\\d+", "*"));

        s = "123456";
        String reg2 = "\\d{0,5}";
        System.out.println(s.matches(reg2));

    }
}
